<!--智能回复-->
{include file="public/header"}
<div class="content">
<div class="page-inner">
<div class="row">
<div class="col-md-12">
<div class="card">

	<div class="form-group">
	    <form>
	    
		<input type="text" id="id" value="{$api['id']}" class="form-control">		
    	<label for="successInput">关键词</label>
    	<input type="text" id="keywords" value="{$api['keywords']}" class="form-control">		
		
        <br>
		<label for="comment">回复内容</label>
		<textarea class="form-control"  id="text" rows="5">{$api['text']}</textarea>
        </form>
        		<button type="submit" onclick="add_api()" class="btn btn-success">保存</button>
	</div>



	
</div>
</div>
</div>
</div>
</div>

{include file="public/footer"}

<script>

    function add_api(){
        
        var id = $('#id').val();
        var keywords = $('#keywords').val();
        var text = $('#text').val();
        
        if(!keywords || !id || !text){
               $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: '请填写关键词',
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
              return;
        }
        $.post('/huifu_edit',{'id':id,'keywords':keywords,'text':text},function(res){
            if(res.code>0){
                $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
            }else{

               $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
                setTimeout(function(){window.history.back();},800);
            }
        },'json');
        
    }
</script>